Add support for opening external links in system browser#21
Merged
Conversation
Clicking an http/https/mailto link in rendered markdown now opens it in the default system browser instead of navigating the app window. Right-clicking such a link shows a context menu with options to copy the link or open it in the browser. URL protocols are validated in the main process before handing off to shell.openExternal. Closes #16 https://claude.ai/code/session_01A83A3GHjE9aQz4C6zhwar9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds functionality to handle external links (http, https, mailto) in the markdown viewer by opening them in the system's default browser or handler, rather than attempting to navigate within the application.
Key Changes
setupLinkHandling()to intercept clicks on external links and open them via the system browserisExternalUrl()helper to identify external URLs by protocol (http, https, mailto)OPEN_EXTERNALIPC handler with protocol validation to prevent opening dangerous URLs (file://, javascript://, etc.)openExternal()method toShellAPIinterface and corresponding IPC channelshell.openExternal()to renderer process via electron APIOPEN_EXTERNALhandler, including validation of allowed protocols and rejection of invalid URLsImplementation Details
http:,https:,mailto:) is enforced at the main process level for securityhttps://claude.ai/code/session_01A83A3GHjE9aQz4C6zhwar9